package com.enen.demo.dao;

import com.enen.demo.bean.Article;
import com.enen.demo.bean.Category;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ArticleDao {

    @Insert("insert into cms_article(id, title, content, publish_time, read_times, status, thump_up, cover, project_id, author_id, category_id, compony_id) " +
            "values(id, title, content, publishTime, readTimes, status, thumpUp, cover, projectId, authorId, categoryId, componyId)")
    void save(Article Article);

    @Select("select * from cms_article")
    List<Article> selectAll();

    @Select("select * from cms_article where id = #{id}")
    Article selectArticleById(long id);

    @Delete("delete from cms_article where id = #{id}")
    void delete(long id);

    @Update("update cms_article set  where id = #{id}")
    void update(Article article);
}
